import org.apache.spark.sql.SparkSession

import scala.reflect.io.Directory

object JsonData extends App {
  val sparkSession = SparkSession.builder
    .master("local")
    .appName("json-data-scala")
    .getOrCreate()

  //指定resources 目录下的文件
  var filePath = "file:///" +
    Directory.Current.get.toString() +
    "\\data\\employee.json"

  sparkSession.read
    .json(filePath)
    .createOrReplaceTempView("employee_table")

  //查询
  sparkSession.sql("select * from employee_table").show

}
